<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="basepath.BasePath"%>
<%@page import="java.io.File"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>查看提交</title>
</head>
<body>
	<%@ include file="student_head.jsp"%>
	<div class="container">
		<div class="row">
			<div class="form-inline">
				<img src="../../resource/student.jpg" class="img-rounded"
					style="float: left; height: 60px;" />
				<h1>
					<strong>上机考试考试进行中</strong>
				</h1>
			</div>
		</div>

		<h3>
			<strong>已上传文件列表</strong>
		</h3>
		<table class="table table-striped table-bordered table-hover">
			<thead>
				<tr>
					<td>文件名</td>
					<td>文件大小</td>
					<td>上传时间</td>
				</tr>
			</thead>
			<tbody>
				<%
					BasePath b = new BasePath();
					if (b != null) {
						String path = b.getRealBasePath(request) 
								+ "data/answerpaper/"
								+session.getAttribute("examcreator").toString()+"/"
								+session.getAttribute("examname").toString()+"/"
								+ session.getAttribute("studentname").toString() + "/";
						File dir = new File(path);
						if (dir != null) {
							File[] files = dir.listFiles();
							if (files != null) {
								for (int i = 0; i < files.length; i++) {
				%>
				<tr>
					<td><%=files[i].getName()%></td>
					<td><%=files[i].length() / 8%>B</td>
					<td><%=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(files[i].lastModified())%></td>
				</tr>
				<%
					}
							}
						}
					}
				%>
			</tbody>

		</table>

		<div>
			<h2>
				<strong>答案上传</strong>
			</h2>
			<p>请按照考试要求将答案文件打包,再次进行上传.同名文件多次上传将会覆盖.</p>

			<form action="../../servlet_upload" method="post"
				enctype="multipart/form-data">

				<div class="form-inline">

					<button type="button" onclick="path.click()"
						class="btn btn-info glyphicon glyphicon-folder-open">浏览</button>

					<input type="text" name="upfile" id="upfile" class="form-control"
						placeholder="未选择文件" readonly="readonly"> <input
						type="file" id="path" name="upload" style="display: none"
						onchange="upfile.value=this.value">

					<button type="submit"
						class="btn btn-info glyphicon glyphicon-cloud-upload"
						style="display: inline; float: right">上传</button>

				</div>

			</form>

		</div>
	</div>
</body>
</html>